package com.fmsz.xmly.fragments.subscriptionfgts;


import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.TextView;

import com.fmsz.xmly.R;
import com.fmsz.xmly.activitys.myselfactivity.LoginActivity;
import com.fmsz.xmly.callbacks.SubscroptionPage;

/**
 * A simple {@link Fragment} subclass.
 */
public class SubscripFragment extends Fragment implements View.OnClickListener {

    private Button button_lookrecommend;
    private TextView loginexist;
    private SubscroptionPage subscroptionPage;


    public SubscripFragment(SubscroptionPage subscroptionPage) {
        this.subscroptionPage = subscroptionPage;
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        // Inflate the layout for this fragment
        return inflater.inflate(R.layout.fragment_subscrip, container, false);
    }

    @Override
    public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);
        button_lookrecommend = (Button) view.findViewById(R.id.button_lookrecommend);
        button_lookrecommend.setOnClickListener(this);
        loginexist = (TextView) view.findViewById(R.id.loginexist);
        loginexist.setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.button_lookrecommend:
                subscroptionPage.setCurrentPage();
                break;
            case R.id.loginexist:
                Intent loginexist = new Intent(getContext(), LoginActivity.class);
                startActivity(loginexist);
                getActivity().overridePendingTransition(R.anim.push_in_buttom, R.anim.leave_in_button);
                break;
        }

    }
}
